<?php

/**
 * Description of ExplorarPuertos
 *
 * @author JeyDotC
 * 
 * @export Modules
 * @export-metadata RequiredRoles:Agencia
 */
class ExplorarPuertos extends Module {

    private $puertosPerPage = 50;

    public function index() {
        $paises = $this->components->Paises->getAll();

        $this->assign("paises", $paises);

        $this->display("ExplorarPuertos:index");
    }

    public function puertosByPais() {
        $idPais = $this->request->get("idPais");
        $pagina = $this->request->get("page", 0);

        $puertos = $this->components->Puertos->getByPais($idPais, $pagina * $this->puertosPerPage, $this->puertosPerPage);

        $this->assign("puertos", $puertos);
        
        $this->display("ExplorarPuertos:puertosByPais");
    }

}

?>
